<?php
$page_title="Manage Email Groups - List";
include("includes/header.php");

	$query = "SELECT *,M.members FROM bkitc_email_group G LEFT JOIN (select fk_group_id,count(fk_member_id) as members from bkitc_email_group_map group by fk_group_id) M ON M.fk_group_id=G.group_id where rec_status=1";
	$email_groups = qry_data($query." order by  group_name ");
	
?>
<script src="../calendarDateInput.js" language="javascript"></script>
<table width="100%">
	<tr>
		<td valign="top">
			<div class="fleft">
		<ul class="subMenu">
		<li><a href="edit_email.php?mode=add" >Add New Group</a></li>
		
		</ul>
		</div>		
		<div class="cleardiv">
		
		</div>	

		<table   width="100%" class="table_panel" cellspacing="0" cellpadding="4">
		<tr  align="left">
		<th width="5">S.No</th>
		<th > List Name</th>
		<th>Description</th>
		<th>Remarks</th>
		<th width="5">Last Updated</th>		
		<th >Member Count</th>		
		<th width="71px">Edit/Delete</th>
		</tr>
		<? foreach($email_groups as $i=>$group) {?>
	
		<tr <?if($i%2==0) echo 'class="white_bg"'; else echo 'class="grey_bg"' ?>>
		<td><?=$i+1;?></td>
		
		<td><?=$group["group_name"];?></td>
		<td><?=$group["group_desc"];?></td>
		<td><?=$group["group_remarks"];?></td>
		<td><?=$group["last_updated"]?></td>
		<td width="5"><?=(int)$group["members"]?></td>	
		<td><a href="edit_email.php?mode=edit&gid=<?=$group["group_id"];?>">Edit</a> | 

		<a  href="javascript:if(confirm('Are you sure to delete this email group?')) location.href='edit_email_pro.php?mode=del&gid=<?=$group["group_id"];?>'";>Delete</a> 
		
		</td>
		</tr>
		
		<? } ?>
		</table>

</td>
</tr>

</table>

<?php include("includes/footer.php"); ?>

